package com.fallingmanage.myapp.web.rest_注册登录;

import java.util.Optional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fallingmanage.myapp.newService.RegisteredSignInService;
import com.fallingmanage.myapp.util.Result;

import io.github.jhipster.web.util.ResponseUtil;
import io.micrometer.core.annotation.Timed;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;


@RestController
@RequestMapping("/registeredSign")
@Api(tags = "注册登录")
public class RegisteredSignInResource {

    private final Logger log = LoggerFactory.getLogger(RegisteredSignInResource.class);

    private final RegisteredSignInService registeredSignInService;

    public RegisteredSignInResource(RegisteredSignInService registeredSignInService) {

        this.registeredSignInService = registeredSignInService;
    }

    /**
     * 判断账号是否存在
     * */
    @PostMapping("/account/existence")
    @ApiOperation(value = "判断账号是否存在")
    @Timed
    public ResponseEntity<Result> AccountNumberExistence(@RequestParam String phone) {
    	Result result = registeredSignInService.accountNumberExistence(phone);
		log.debug("访问地址: {},传入值: {},返回值: {}", "/account/existence", phone, result);
		return ResponseUtil.wrapOrNotFound(Optional.ofNullable(result));
    }

}
